package cn.com.inossem.utils.view;

import android.annotation.SuppressLint;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;
import cn.com.inossem.activity.R;

@SuppressLint("NewApi")
public class BaGuaBiaoQianDialogFragment extends DialogFragment {

	EditText editText;
	TextView queding, quxiao;

	public interface biaoqianListener {
		void onLoginInputComplete(String edit);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
		View view = inflater.inflate(R.layout.baguabiaoqian_dialog, container);

		editText = (EditText) view.findViewById(R.id.editText);
		//
		// ((InputMethodManager) getActivity().getSystemService(
		// getActivity().INPUT_METHOD_SERVICE)).showSoftInput(editText,
		// 500);
		// editText.setSelection(editText.getText().length());

		queding = (TextView) view.findViewById(R.id.queding);

		queding.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				biaoqianListener listener = (biaoqianListener) getActivity();

				listener.onLoginInputComplete(editText.getText().toString());
			}
		});

		quxiao = (TextView) view.findViewById(R.id.quxiao);

		quxiao.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				BaGuaBiaoQianDialogFragment.this.dismiss();

			}
		});

		return view;
	}
}
